<template>
  <div class="showStudent">
    <h2>学生姓名:{{ name }}</h2>
    <h2>学生年龄:{{ age }}</h2>
    <button @click="showStudent">展示更多信息</button>
  </div>
</template>

<script>
export default {
  name: "Student",
  data() {
    return {
      name: "张三",
      age: "21",
      gender: "男",
      subject: "前端",
    };
  },
  methods: {
    showStudent() {
      alert(`性别:${this.gender},学科:${this.subject}`)
    }
  }
}
</script>

<style>
.showStudent {
  background-color: skyblue;
  padding: 20px;
}
</style>
